<script setup lang="ts">
import type { TransactionForm } from '@/types';

import Row from './Row.vue';

const transactionForm = defineModel<TransactionForm>({ required: true });
const dialogFormVisible4 = defineModel<boolean>('visible4');
</script>

<template>
  <el-dialog title="订单（详细信息）" v-model="dialogFormVisible4" width="50%" draggable overflow>
    <div class="row-container">
      <Row label="买家ID:" :content="transactionForm.buyer_id" />
      <Row label="买家姓名:" :content="transactionForm.buyer_name" />
      <Row label="买家所在学院:" :content="transactionForm.buyer_college" />
      <Row label="买家所在专业:" :content="transactionForm.buyer_major" />
      <Row label="卖家ID:" :content="transactionForm.seller_id" />
      <Row label="卖家姓名:" :content="transactionForm.seller_name" />
      <Row label="卖家所在学院:" :content="transactionForm.seller_college" />
      <Row label="卖家所在专业:" :content="transactionForm.seller_major" />
      <Row label="交易书籍名称:" :content="transactionForm.books_name" />
      <Row label="交易书籍编号:" :content="transactionForm.book_code" />
      <Row label="交易日期:" :content="transactionForm.transaction_date" />
      <Row label="成交金额:" :content="transactionForm.amount" />
      <Row label="交易数量:" :content="transactionForm.quantity" />
      <Row label="交易ID:" :content="transactionForm.id" />
    </div>
  </el-dialog>
</template>

<style>
.row-container {
  display: flex;
  flex-wrap: wrap;
  gap: 10px; /* 间距 */
}

.row {
  display: flex;
  align-items: center;
  flex: 1 0 45%; /* 每个 row 占据 45% 的宽度，留出一些间距 */
  min-width: 200px; /* 最小宽度，防止内容过窄 */
  margin-bottom: 10px;
}

.label {
  box-sizing: border-box;
  width: 100px;
  text-align: right;
  padding-right: 12px;
}

.content {
  flex: 1;
}
.avatar-uploader {
  width: 10%;
}

.avatar-uploader .el-upload:hover {
  border-color: #409eff;
}
</style>
<style scoped>
.avatar-uploader .avatar {
  width: 178px;
  height: 178px;
  display: block;
}
</style>

<style>
.avatar-uploader .el-upload {
  border: 1px dashed var(--el-border-color);
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: var(--el-transition-duration-fast);
}

.avatar-uploader .el-upload:hover {
  border-color: var(--el-color-primary);
}

.el-icon.avatar-uploader-icon {
  font-size: 28px;
  color: #8c939d;
  width: 178px;
  height: 178px;
  text-align: center;
}
</style>
